## Hello, wellcome <3

## fist of all, what is docker?
> Docker is an *open platform for developing, shipping, and running applications*. Docker **enables you to separate your applications from your infrastructure so you can deliver software quickly**.

* Docker provides the ability to package and run an application in a loosely isolated environment called a container.

---
## the structure of docker

Imagine that you have a recipe for a chocolate cake, which you can search on the internet and make the cake at home, this recipe is the base of the cake, right? And the cake is the "final" and "edible" product... with this little analogy I think we can understand what docker is...

> imagine you can make a recipe for an OS (operating system) and once you read it, it runs like a cake, I mean, a final product that you can use *- not just an OS, you can run the environment hole, imagine that you can read the cake recipe and evoke the utensils, the ingredients, or better yet, the chef's entire kitchen :P-*

This is the idea.

You have the recipes (docker images), which contains the configurations and dependencies you need to run this cake (docker container). The images are allocated in a repository *- just like a git repository -* you can download them, edit them and make your own recipes. You can download a chocolate cake, change your recipe locally to be a vanilla cake and post it in your own repository :P so everyone can eat your cake

Docker does exactly that, you can download an image, run it locally, as an application and run it anywhere (as it will be contained in a docker image and run locally as a container).

Using the same analogy, we could want to eat several of the cakes, and this is easy to do with images, just rotate them and another environment (another container) will be created, thus leaving it to cloud servers (or container orchestrators, which we will not cover in this repository, I think) automatically scale the application horizontally, making it receive more requests, for example.

Very roughly, and directly, this is what a container is, and does, however, it is much more comprehensive than just that, and there can be countless applications of an application running in a container. Anyway, that's it, now, it's codes, and error logs :P

---
## the main idea

If you are a little more technical I think it's better to know how this works for an IT professional :P

first we need to understand what hypervisors are and how they work, then VM (virtual machines), then like containers, THEN like docker, although it's simple, I promise

First, what are hypervisors? They are basically software that abstracts the hardware layer, making a virtual machine (VM) THINK it is running on physical hardware, imagine that you have one computer, and with a hypervisor you can create 20 within the same computer (of course , which will depend on your own computer's hardware, the hypervisor is limited to the machine that is running it, even if it can emulate virtual hardware, bottlenecks will occur if it exceeds a certain limit)
 
There are two types of hypervisors, type 1) run directly on the computer hardware, and type 2) run with the help of a host OS (that is, an operating system needs to be downloaded for the hypervisor to be running). We generally use type 2, such as VirtualBox, or KVM, but we will not go into these merits

And so:
> Linux containers and virtual machines are packaged computing environments that combine multiple IT components and isolate them from the rest of the system.

Imagine a container as a VM that someone packaged and left ready for you to use, however the abstraction layer is even lower, instead of having direct access to the hardware, the container shares space with the Host operating system, as well as the hypervisor of the type 2, however with some differences, the container, as it is lightweight, and has this objective, shares some resources with the host OS, such as the Kernel itself (Docker, was made to run on Linux. When running on Windows, When downloading docker, it creates an abstraction layer, making containers and images think they are running on Linux)

This way, containers are lighter, as they are not complete operating systems, but they are still isolated, by very intelligent abstractions and codes written by docker developers :P

calm down (?) but container != docker? YES.

container is a technology that spread along with the emergence and evolution of docker, but as a hypervisor, others such as LCX, Win Hypervisor, Podman (note, I'm not sure of the technology or origin of this information, just keep in mind, that these exist)

We could also go into detail about what container orchestrators are and how they work, however, it will not be necessary.

Basically, that's it

---
## Some commands :P

### adding a image to the local OS

let's start remotely (basically it will copy the container image, so you can run it locally as a container properly later)

```sh
# docker pull IMAGE
```

### list images
```sh
# docker images
```

### run a image

it'll run startup a new container, some container have diferent 

```
# docker run IMAGE-NAME # just start a container, don't run, don't do nothing
# docker run -ti IMAGE-NAME # start a container with a InterativeTerminal (as a OS)
```

### commiting a image from a container

* as a localy commit (like on git)\
```
docker commit CONTAINER-ID
## ORRR U CAN USE THIS:
docker commit CONTAINER-ID YOUR-USER-NAME/IMAGE-NAME-THAT-U-WANNA-PUSH # this tag the image with and commit this.
```

* now u need to "tag" this image: 
```
docker tag IMAGE-ID YOUR-USER-NAME/IMAGE-NAME-THAT-U-WANNA-PUSH
```

now u need to push the image that u've just "tagged":
```
docker push YOUR-USER-NAME/IMAGE-NAME-THAT-U-WANNA-PUSH
```